﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IRepository;
using Models;
using Infrastructures;

namespace ConcreteService
{
    public class UserValidationService : CommonService
    {
        internal UserValidationService() { }

        public void SendValidationMessage(UserValidation obj)
        {
            switch (obj.AccountType)
            {
                case AccountType.Phone:
                    MessageUtil.SendPhoneMessage(obj);
                    ProcessHelper.ProcessAfterDone(obj, obj.AccountValue, EventType.SendCAPTCHA, false);
                    break;
                case AccountType.Mail:
                    //MessageUtil.SendMailMessage(obj);
                    ICommonRepository repo = ServiceFactory.CreateInstance<ICommonRepository>();
                    repo.Create(obj);
                    LogUtil.Create(obj.UserID, EventType.SendValidMail, "UserValidation", obj.ToString());
                    break;
            }
        }
    }
}
